X-Git-Url: https://git.r.bdr.sh/rbdr/super-polarity/blobdiff_plain/097781e6ad3f7bb1c13c16ff7b6bb7219764fb29..b587e9d8e0cc5eb1edf972fd3b644704441e5289:/Super%20Polarity/Actors/Actor.cs diff --git a/Super Polarity/Actors/Actor.cs b/Super Polarity/Actors/Actor.cs index c317796..3bb06be 100644 --- a/Super Polarity/Actors/Actor.cs +++ b/Super Polarity/Actors/Actor.cs @@ -204,13 +204,21 @@ namespace SuperPolarity public virtual void Draw(SpriteBatch spriteBatch) { - foreach (Actor child in Children) + Actor child = null; + + // TODO: Check what's up with the null children. + if (Children == null) { + return; + } + for (var i = Children.Count - 1; i >= 0; i--) + { + child = Children[i]; child.Draw(spriteBatch); } spriteBatch.Draw(Texture, Position, null, Color, Angle, Origin, 1f, SpriteEffects.None, 0f); - spriteBatch.Draw(BoxTexture, Box, new Color(255, 0, 255, 25)); + //spriteBatch.Draw(BoxTexture, Box, new Color(255, 0, 255, 25)); } void CheckOutliers() @@ -247,5 +255,13 @@ namespace SuperPolarity { Dying = true; } + + public virtual void CleanUp() + { + Texture = null; + BoxTexture = null; + Children = null; + Texture = null; + } } }